package main

import (
	"io"
	"log"
	"net/http"
	"os"
)

func main() {
	// 发起GET请求
	response, err := http.Get("https://gitee.com/ztihao/go-plugin/repository/archive/master.zip")
	if err != nil {
		log.Fatal("Error fetching URL:", err)
	}
	defer response.Body.Close()

	// 创建输出文件
	file, err := os.Create("./master.zip")
	if err != nil {
		log.Fatal("Error creating output file:", err)
	}
	defer file.Close()

	// 将响应体写入到输出文件中
	_, err = io.Copy(file, response.Body)
	if err != nil {
		log.Fatal("Error writing to output file:", err)
	}

	log.Printf("Downloaded succ\n")
}
